#include <hxcpp.h>

#ifndef INCLUDED_Hash
#include <Hash.h>
#endif
#ifndef INCLUDED_haxe_Log
#include <haxe/Log.h>
#endif
#ifndef INCLUDED_haxe_Public
#include <haxe/Public.h>
#endif
#ifndef INCLUDED_jax_JClassField
#include <jax/JClassField.h>
#endif
#ifndef INCLUDED_jax_JConstant
#include <jax/JConstant.h>
#endif
#ifndef INCLUDED_jax_JVM
#include <jax/JVM.h>
#endif
#ifndef INCLUDED_jax_JValue
#include <jax/JValue.h>
#endif
#ifndef INCLUDED_jax_lang_JClass
#include <jax/lang/JClass.h>
#endif
#ifndef INCLUDED_jax_lang_JField
#include <jax/lang/JField.h>
#endif
#ifndef INCLUDED_jax_lang_JObject
#include <jax/lang/JObject.h>
#endif
namespace jax{
namespace lang{

Void JObject_obj::__construct()
{
{
	HX_SOURCE_POS("Source/jax/lang/JObject.hx",7)
	this->_fields = Array_obj< ::jax::lang::JField >::__new();
	HX_SOURCE_POS("Source/jax/lang/JObject.hx",8)
	this->_w = false;
	HX_SOURCE_POS("Source/jax/lang/JObject.hx",9)
	this->_type = HX_CSTRING("java/lang/Object");
}
;
	return null();
}

JObject_obj::~JObject_obj() { }

Dynamic JObject_obj::__CreateEmpty() { return  new JObject_obj; }
hx::ObjectPtr< JObject_obj > JObject_obj::__new()
{  hx::ObjectPtr< JObject_obj > result = new JObject_obj();
	result->__construct();
	return result;}

Dynamic JObject_obj::__Create(hx::DynamicArray inArgs)
{  hx::ObjectPtr< JObject_obj > result = new JObject_obj();
	result->__construct();
	return result;}

hx::Object *JObject_obj::__ToInterface(const type_info &inType) {
	if (inType==typeid( ::haxe::Public_obj)) return operator ::haxe::Public_obj *();
	return super::__ToInterface(inType);
}

Void JObject_obj::notify( ){
{
		HX_SOURCE_PUSH("JObject_obj::notify")
		HX_SOURCE_POS("Source/jax/lang/JObject.hx",19)
		this->_w = true;
	}
return null();
}


HX_DEFINE_DYNAMIC_FUNC0(JObject_obj,notify,(void))

Void JObject_obj::notifyAll( ){
{
		HX_SOURCE_PUSH("JObject_obj::notifyAll")
		HX_SOURCE_POS("Source/jax/lang/JObject.hx",22)
		this->_w = true;
	}
return null();
}


HX_DEFINE_DYNAMIC_FUNC0(JObject_obj,notifyAll,(void))

Void JObject_obj::wait( ){
{
		HX_SOURCE_PUSH("JObject_obj::wait")
		HX_SOURCE_POS("Source/jax/lang/JObject.hx",25)
		while((!(this->_w))){
		}
	}
return null();
}


HX_DEFINE_DYNAMIC_FUNC0(JObject_obj,wait,(void))

::String JObject_obj::toString( ){
	HX_SOURCE_PUSH("JObject_obj::toString")
	HX_SOURCE_POS("Source/jax/lang/JObject.hx",28)
	return this->_type;
}


HX_DEFINE_DYNAMIC_FUNC0(JObject_obj,toString,return )

::jax::lang::JField JObject_obj::getField( ::jax::JConstant cn){
	HX_SOURCE_PUSH("JObject_obj::getField")
	HX_SOURCE_POS("Source/jax/lang/JObject.hx",32)
	::jax::lang::JClass c = ::jax::JVM_obj::classes->get(this->_type);
	HX_SOURCE_POS("Source/jax/lang/JObject.hx",33)
	::String n = null();
	::String t = null();
	HX_SOURCE_POS("Source/jax/lang/JObject.hx",34)
	{
::jax::JConstant _switch_1 = (cn);
		switch((_switch_1)->GetIndex()){
			case 10: {
				int ta = _switch_1->__Param(1);
				int na = _switch_1->__Param(0);
{
					HX_SOURCE_POS("Source/jax/lang/JObject.hx",35)
					{
::jax::JConstant _switch_2 = (c->const_pool->__get(ta));
						switch((_switch_2)->GetIndex()){
							case 7: {
								int ti = _switch_2->__Param(1);
								int ni = _switch_2->__Param(0);
{
									HX_SOURCE_POS("Source/jax/lang/JObject.hx",38)
									n = ::jax::JVM_obj::toNativeValue(::jax::JVM_obj::toValue(c->const_pool->__get(ni),null()));
									HX_SOURCE_POS("Source/jax/lang/JObject.hx",39)
									t = ::jax::JVM_obj::toNativeValue(::jax::JVM_obj::toValue(c->const_pool->__get(ti),null()));
								}
							}
							;break;
							default: {
							}
						}
					}
				}
			}
			;break;
			default: {
				HX_SOURCE_POS("Source/jax/lang/JObject.hx",42)
				hx::Throw (HX_CSTRING("Invalid field reference"));
			}
		}
	}
	HX_SOURCE_POS("Source/jax/lang/JObject.hx",45)
	::haxe::Log_obj::trace((HX_CSTRING("Field Name: ") + n),hx::SourceInfo(HX_CSTRING("JObject.hx"),45,HX_CSTRING("jax.lang.JObject"),HX_CSTRING("getField")));
	HX_SOURCE_POS("Source/jax/lang/JObject.hx",46)
	::haxe::Log_obj::trace((HX_CSTRING("Field Type: ") + t),hx::SourceInfo(HX_CSTRING("JObject.hx"),46,HX_CSTRING("jax.lang.JObject"),HX_CSTRING("getField")));
	HX_SOURCE_POS("Source/jax/lang/JObject.hx",48)
	{
		HX_SOURCE_POS("Source/jax/lang/JObject.hx",48)
		int _g = (int)0;
		Array< ::jax::lang::JField > _g1 = this->_fields;
		HX_SOURCE_POS("Source/jax/lang/JObject.hx",48)
		while(((_g < _g1->length))){
			HX_SOURCE_POS("Source/jax/lang/JObject.hx",48)
			::jax::lang::JField f = _g1->__get(_g);
			HX_SOURCE_POS("Source/jax/lang/JObject.hx",48)
			++(_g);
			HX_SOURCE_POS("Source/jax/lang/JObject.hx",49)
			if (((bool((f->name == n)) && bool((f->type == t))))){
				HX_SOURCE_POS("Source/jax/lang/JObject.hx",51)
				::haxe::Log_obj::trace(HX_CSTRING("Match!"),hx::SourceInfo(HX_CSTRING("JObject.hx"),51,HX_CSTRING("jax.lang.JObject"),HX_CSTRING("getField")));
				HX_SOURCE_POS("Source/jax/lang/JObject.hx",53)
				return f;
			}
		}
	}
	HX_SOURCE_POS("Source/jax/lang/JObject.hx",56)
	return null();
}


HX_DEFINE_DYNAMIC_FUNC1(JObject_obj,getField,return )

::jax::lang::JObject JObject_obj::clone( ){
	HX_SOURCE_PUSH("JObject_obj::clone")
	HX_SOURCE_POS("Source/jax/lang/JObject.hx",59)
	::jax::lang::JObject obj = ::jax::lang::JObject_obj::__new();
	HX_SOURCE_POS("Source/jax/lang/JObject.hx",60)
	obj->_type = this->_type;
	HX_SOURCE_POS("Source/jax/lang/JObject.hx",61)
	{
		HX_SOURCE_POS("Source/jax/lang/JObject.hx",61)
		int _g = (int)0;
		Array< ::jax::lang::JField > _g1 = this->_fields;
		HX_SOURCE_POS("Source/jax/lang/JObject.hx",61)
		while(((_g < _g1->length))){
			HX_SOURCE_POS("Source/jax/lang/JObject.hx",61)
			::jax::lang::JField f = _g1->__get(_g);
			HX_SOURCE_POS("Source/jax/lang/JObject.hx",61)
			++(_g);
			HX_SOURCE_POS("Source/jax/lang/JObject.hx",62)
			::jax::lang::JField nf = ::jax::lang::JField_obj::__new(f->name,f->type,f->access_flags);
			HX_SOURCE_POS("Source/jax/lang/JObject.hx",63)
			nf->value = f->value;
			HX_SOURCE_POS("Source/jax/lang/JObject.hx",64)
			obj->_fields->push(nf);
		}
	}
	HX_SOURCE_POS("Source/jax/lang/JObject.hx",66)
	return obj;
}


HX_DEFINE_DYNAMIC_FUNC0(JObject_obj,clone,return )

Void JObject_obj::init( ::jax::lang::JObject o,::jax::lang::JClass c){
{
		HX_SOURCE_PUSH("JObject_obj::init")
		HX_SOURCE_POS("Source/jax/lang/JObject.hx",12)
		int _g = (int)0;
		Array< ::jax::JClassField > _g1 = c->cfields;
		HX_SOURCE_POS("Source/jax/lang/JObject.hx",12)
		while(((_g < _g1->length))){
			HX_SOURCE_POS("Source/jax/lang/JObject.hx",12)
			::jax::JClassField f = _g1->__get(_g);
			HX_SOURCE_POS("Source/jax/lang/JObject.hx",12)
			++(_g);
			HX_SOURCE_POS("Source/jax/lang/JObject.hx",13)
			::String nm = ::jax::JVM_obj::toNativeValue(::jax::JVM_obj::toValue(c->const_pool->__get(f->name_index),null()));
			HX_SOURCE_POS("Source/jax/lang/JObject.hx",14)
			::String ty = ::jax::JVM_obj::toNativeValue(::jax::JVM_obj::toValue(c->const_pool->__get(f->descriptor_index),null()));
			HX_SOURCE_POS("Source/jax/lang/JObject.hx",15)
			int af = f->access_flags;
			HX_SOURCE_POS("Source/jax/lang/JObject.hx",16)
			o->_fields->push(::jax::lang::JField_obj::__new(nm,ty,af));
		}
	}
return null();
}


STATIC_HX_DEFINE_DYNAMIC_FUNC2(JObject_obj,init,(void))


JObject_obj::JObject_obj()
{
}

void JObject_obj::__Mark(HX_MARK_PARAMS)
{
	HX_MARK_BEGIN_CLASS(JObject);
	HX_MARK_MEMBER_NAME(_type,"_type");
	HX_MARK_MEMBER_NAME(_fields,"_fields");
	HX_MARK_MEMBER_NAME(_w,"_w");
	HX_MARK_END_CLASS();
}

void JObject_obj::__Visit(HX_VISIT_PARAMS)
{
	HX_VISIT_MEMBER_NAME(_type,"_type");
	HX_VISIT_MEMBER_NAME(_fields,"_fields");
	HX_VISIT_MEMBER_NAME(_w,"_w");
}

Dynamic JObject_obj::__Field(const ::String &inName,bool inCallProp)
{
	switch(inName.length) {
	case 2:
		if (HX_FIELD_EQ(inName,"_w") ) { return _w; }
		break;
	case 4:
		if (HX_FIELD_EQ(inName,"init") ) { return init_dyn(); }
		if (HX_FIELD_EQ(inName,"wait") ) { return wait_dyn(); }
		break;
	case 5:
		if (HX_FIELD_EQ(inName,"_type") ) { return _type; }
		if (HX_FIELD_EQ(inName,"clone") ) { return clone_dyn(); }
		break;
	case 6:
		if (HX_FIELD_EQ(inName,"notify") ) { return notify_dyn(); }
		break;
	case 7:
		if (HX_FIELD_EQ(inName,"_fields") ) { return _fields; }
		break;
	case 8:
		if (HX_FIELD_EQ(inName,"toString") ) { return toString_dyn(); }
		if (HX_FIELD_EQ(inName,"getField") ) { return getField_dyn(); }
		break;
	case 9:
		if (HX_FIELD_EQ(inName,"notifyAll") ) { return notifyAll_dyn(); }
	}
	return super::__Field(inName,inCallProp);
}

Dynamic JObject_obj::__SetField(const ::String &inName,const Dynamic &inValue,bool inCallProp)
{
	switch(inName.length) {
	case 2:
		if (HX_FIELD_EQ(inName,"_w") ) { _w=inValue.Cast< bool >(); return inValue; }
		break;
	case 5:
		if (HX_FIELD_EQ(inName,"_type") ) { _type=inValue.Cast< ::String >(); return inValue; }
		break;
	case 7:
		if (HX_FIELD_EQ(inName,"_fields") ) { _fields=inValue.Cast< Array< ::jax::lang::JField > >(); return inValue; }
	}
	return super::__SetField(inName,inValue,inCallProp);
}

void JObject_obj::__GetFields(Array< ::String> &outFields)
{
	outFields->push(HX_CSTRING("_type"));
	outFields->push(HX_CSTRING("_fields"));
	outFields->push(HX_CSTRING("_w"));
	super::__GetFields(outFields);
};

static ::String sStaticFields[] = {
	HX_CSTRING("init"),
	String(null()) };

static ::String sMemberFields[] = {
	HX_CSTRING("_type"),
	HX_CSTRING("_fields"),
	HX_CSTRING("_w"),
	HX_CSTRING("notify"),
	HX_CSTRING("notifyAll"),
	HX_CSTRING("wait"),
	HX_CSTRING("toString"),
	HX_CSTRING("getField"),
	HX_CSTRING("clone"),
	String(null()) };

static void sMarkStatics(HX_MARK_PARAMS) {
};

static void sVisitStatics(HX_VISIT_PARAMS) {
	HX_VISIT_MEMBER_NAME(JObject_obj::__mClass,"__mClass");
};

Class JObject_obj::__mClass;

void JObject_obj::__register()
{
	Static(__mClass) = hx::RegisterClass(HX_CSTRING("jax.lang.JObject"), hx::TCanCast< JObject_obj> ,sStaticFields,sMemberFields,
	&__CreateEmpty, &__Create,
	&super::__SGetClass(), 0, sMarkStatics, sVisitStatics);
}

void JObject_obj::__boot()
{
}

} // end namespace jax
} // end namespace lang
